"""
冒泡排序：O(n) or O(n^2)
"""


def bubble_sort(seq):
    for i in range(1, len(seq)):
        for j in range(0, len(seq) - i):
            if seq[j] > seq[j+1]:
                seq[j], seq[j+1] = seq[j+1], seq[j]

    return seq


if __name__ == '__main__':
    sequence = [12, 27, 46, 16, 25, 37, 22, 29, 15, 47, 48, 34]
    print(sequence)
    print(bubble_sort(sequence))

